﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Users.aspx.cs" Inherits="Users_Users" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <title>Usuarios</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        Usuarios&nbsp;<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/icon_add.png"
            OnClick="ImageButton_Click1" />
        <asp:ImageButton ID="imgRoles" runat="server" ImageUrl="~/Images/icon_role.png" OnClick="imgRoles_Click" />
    </h2>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        CellPadding="4" DataKeyNames="UserId" DataSourceID="EntityDataSource1" ForeColor="#333333"
        GridLines="None" Style="margin-right: 3px" Width="100%" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        OnRowDataBound="GridView1_RowDataBound" OnRowUpdating="GridView1_RowUpdating">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/icon_cancel.png" EditImageUrl="~/Images/icon_edit.png"
                HeaderText="Editar" ShowEditButton="True" UpdateImageUrl="~/Images/icon_ok.png" />
            <asp:BoundField DataField="UserId" HeaderText="UserId" ReadOnly="True" SortExpression="UserId"
                Visible="False" />
            <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
            <asp:CommandField ButtonType="Image" HeaderText="Roles" SelectImageUrl="~/Images/icon_role.png"
                ShowSelectButton="True" />
            <asp:BoundField DataField="UserPassword" HeaderText="UserPassword" SortExpression="UserPassword"
                Visible="False" />
            <asp:TemplateField HeaderText="Sucursal">
                <ItemTemplate>
                    <asp:Label ID="txtBranchName" runat="server"></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlBranches" runat="server" DataTextField="BranchName" DataValueField="BranchId">
                    </asp:DropDownList>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="BranchId" HeaderText="BranchId" SortExpression="BranchId"
                ConvertEmptyStringToNull="False" Visible="False" />
            <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/icon_delete.png" HeaderText="Borrar"
                ShowDeleteButton="True" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <div id="divUsers">
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
            DataSourceID="EntityDataSource1" ForeColor="#333333" GridLines="None" Height="50px"
            Width="125px" DataKeyNames="UserId" DefaultMode="Insert" OnItemInserted="DetailsView1_ItemInserted"
            OnItemInserting="DetailsView1_ItemInserting" Visible="False">
            <AlternatingRowStyle BackColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <EditRowStyle BackColor="#2461BF" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <Fields>
                <asp:BoundField DataField="UserId" HeaderText="UserId" ReadOnly="True" SortExpression="UserId"
                    Visible="False" />
                <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
                <asp:BoundField ConvertEmptyStringToNull="False" DataField="UserPassword" HeaderText="UserPassword"
                    SortExpression="UserPassword" Visible="False" />
                <asp:BoundField ConvertEmptyStringToNull="False" DataField="BranchId" HeaderText="BranchId"
                    SortExpression="BranchId" Visible="False" />
                <asp:TemplateField HeaderText="Sucursal">
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlBranches" runat="server" DataTextField="BranchName" DataValueField="BranchId">
                        </asp:DropDownList>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:DetailsView>
    </div>
    <div id="divRoles" runat="server" visible="false">
        <asp:ListBox ID="lbxRoles" runat="server" DataTextField="RoleName" DataValueField="RoleId"
            SelectionMode="Multiple"></asp:ListBox>
        <div id="arrows" style="display: inline-block">
            <asp:ImageButton ID="imgLeft" runat="server" ImageUrl="~/Images/icon_arrow-left.png"
                OnClick="imgLeft_Click" /><br />
            <asp:ImageButton ID="imgRight" runat="server" ImageUrl="~/Images/right_arrow-right.png"
                OnClick="imgRight_Click" />
        </div>
        <asp:ListBox ID="lbxUserRoles" runat="server" DataTextField="RoleName" DataValueField="RoleId"
            SelectionMode="Multiple"></asp:ListBox>
    </div>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=ObligatorioDotNetEntities"
        DefaultContainerName="ObligatorioDotNetEntities" EnableFlattening="False" EntitySetName="Users"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>
    <asp:HyperLink ID="Hyperlink1" runat="server" NavigateUrl="~/Branches/Branches.aspx">Sucursales</asp:HyperLink>
    <asp:HyperLink ID="Hyperlink2" runat="server" NavigateUrl="~/Products/Products.aspx">Productos</asp:HyperLink>
    <asp:HyperLink ID="Hyperlink3" runat="server" NavigateUrl="~/Providers/Providers.aspx">Proveedores</asp:HyperLink>
</asp:Content>
